package com.s59.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.xml.ws.Service;

@RestController
@RequestMapping("/demo")
public class DemoController {
    @GetMapping
    public String hello(HttpSession session, HttpServletRequest request){
        request.setAttribute("userName",request.getParameter("userName"));
        return "hello"+session.getId();
    }
    @GetMapping("/text1")
    public String text1(){
        return "text1";
    }
    @GetMapping("/logout")
    public String logout(HttpSession session){
        String id = session.getId();
        session.invalidate();
        return id +"注销成功";

    }
}
